C code for PESelectPrinter

The PESelectPrinter function uses the Windows DEVMODE structure to allow you to select a specific printer for the report to be printed to. The following sample code demonstrates how to use the DEVMODE structure and PESelectPrinter:

struct DEVMODE mode;
char      driverName [] = "EPSON24";
char     printerName [] = "Epson LQ-850";
char     portName [] = "LPT1:";     // Initialize DEVMODE values to zero
memset(&mode, 0, sizeof(mode));     // Initialize DEVMODE structure with appropriate values
lstrcpy(mode.dmDeviceName, "Epson LQ-850");
mode.dmSpecVersion = 0x30A;
mode.dmDriverVersion = 2;
mode.dmSize = sizeof(DEVMODE);
mode.dmDriverExtra = 0;
mode.dmFields = (DM_ORIENTATION | DM_PAPERSIZE | DM_COPIES |
DM_DEFAULTSOURCE | DM_PRINTQUALITY | DM_TTOPTION);
mode.dmOrientation = DMORIENT_LANDSCAPE;
mode.dmPaperSize = DMPAPER_LETTER;
mode.dmCopies = 2;
mode.dmDefaultSource = DMBIN_AUTO;
mode.dmPrintQuality = DMRES_HIGH;
mode.dmTTOption = DMTT_BITMAP; if (!PESelectPrinter(Job, driverName, printerName, portName, &mode)){
    // Handle error
}


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com